Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Bundle Analysis: dedupe caching processing#1184

Merged
JerrySentry merged 3 commits intomainfrom
ba_less_uploads
Mar 27, 2025
Merged

Bundle Analysis: dedupe caching processing#1184
JerrySentry merged 3 commits intomainfrom
ba_less_uploads

Conversation

@JerrySentry
Copy link
Copy Markdown
Contributor

Another attempt at ensuring we don't do BA processor task a bunch of times for each upload that comes in for a commit regardless of the report type. We only need to do cache the bundles one time, all subsequent calls are redundant. In the previous attempt it was directly querying the Upload model for all upload types which is slow, this rework ensures it doesn't directly query Upload and it only makes query if the repo has BA enabled.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@sentry
Copy link
Copy Markdown

sentry Bot commented Mar 27, 2025

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: tasks/bundle_analysis_processor.py

Function Unhandled Issue
process_impl_within_lock UnboundLocalError: cannot access local variable 'result' where it is not associated with a value a...
Event Count: 60

Did you find this useful? React with a 👍 or 👎

@seer-by-sentry
Copy link
Copy Markdown
Contributor

✅ Sentry found no issues in your recent changes ✅

@codecov-notifications
Copy link
Copy Markdown

codecov-notifications Bot commented Mar 27, 2025

Codecov Report

Attention: Patch coverage is 97.87234% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tasks/bundle_analysis_processor.py 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2025

Codecov Report

Attention: Patch coverage is 97.87234% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.71%. Comparing base (6f7f522) to head (497150d).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tasks/bundle_analysis_processor.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1184      +/-   ##
==========================================
- Coverage   97.72%   97.71%   -0.01%     
==========================================
  Files         455      455              
  Lines       37157    37202      +45     
==========================================
+ Hits        36311    36352      +41     
- Misses        846      850       +4     
Flag Coverage Δ
integration 42.76% <10.63%> (-0.05%) ⬇️
unit 90.54% <97.87%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JerrySentry JerrySentry marked this pull request as ready for review March 27, 2025 17:38
Comment thread tasks/bundle_analysis_processor.py Outdated
upload = db_session.query(Upload).filter_by(id_=upload_id).first()
else:
commit_report = report_service.initialize_and_save_report(commit)
# If the upload is not provided that means this is a processor task for caching
Copy link
Copy Markdown
Contributor

@ajay-sentry ajay-sentry Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# This processor task handles caching for reports. When the 'upload' parameter is missing,
# it indicates this task was triggered by a non-BA upload.
#
# To prevent redundant caching of the same parent report:
# 1. We first check if a BA report already exists for this commit
# 2. We then verify there are uploads associated with it that aren't in an error state
#
# If both conditions are met, we can exit the task early since the caching was likely
# already handled. Otherwise, we need to:
# 1. Create a new BA report and upload
# 2. Proceed with caching data from the parent report

Put this comment into cursor just to clean it up a bit, does it still ring true?

Copy link
Copy Markdown
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send it 🫡

@JerrySentry JerrySentry added this pull request to the merge queue Mar 27, 2025
Merged via the queue into main with commit 4baf1ae Mar 27, 2025
23 of 29 checks passed
@JerrySentry JerrySentry deleted the ba_less_uploads branch March 27, 2025 18:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants